package com.asialjim.wechat.official.api;

import com.asialjim.wechat.apiservice.ApiRequest;
import com.asialjim.wechat.apiservice.HttpMethod;
import com.asialjim.wechat.apiservice.constant.WeChatConstants;
import com.asialjim.wechat.core.api.BaseWeChatApi;
import com.asialjim.wechat.core.api.WeChatApiAccessTokenType;
import com.asialjim.wechat.core.api.WeChatApiDefaultRes;
import com.asialjim.wechat.core.api.accesstoken.AccessTokenRes;
import com.asialjim.wechat.official.api.menu.*;
import com.asialjim.wechat.official.api.qrcode.GetQrCodeTicketApiRequest;
import com.asialjim.wechat.official.api.qrcode.GetQrCodeTicketApiResponse;
import com.asialjim.wechat.official.api.templatemessage.*;
import com.asialjim.wechat.official.api.wechatuser.*;
import com.asialjim.wechat.official.message.customer.WeChatCustomerMessage;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.http.entity.ContentType;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: OfficialApi ]</i></h2><strong>
 * <p> we-chat official application api
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 *
 * @author Asial Jim &nbsp;&nbsp; <span>Email:<a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @version 1.0.0
 * @since 2021/3/15   &nbsp;&nbsp; JDK 8
 */
@Getter(AccessLevel.PUBLIC)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public enum OfficialApi implements BaseWeChatApi{

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * get access token
     */
    GET_ACCESS_TOKEN(WeChatConstants.WeChatApiUrl.GET_ACCESS_TOKEN, "getAccessToken",HttpMethod.GET, AccessTokenRes .class,
                     ContentType.APPLICATION_JSON, WeChatApiAccessTokenType.NONE, null,null),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * get access token for we chat user
     */
    GET_ACCESS_TOKEN_FOR_USER(WeChatConstants.WeChatApiUrl.GET_JS_ACCESS_TOKEN,"getAccessTokenForUser",HttpMethod.GET, GetAccessTokenForUserApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.NONE, GetAccessTokenForUserApiRequest.UrlParam.class,null),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * get we-chat user info when user click the auth page url
     */
    GET_USER_INFO_BY_AUTH_PAGE(WeChatConstants.WeChatApiUrl.GET_WECHAT_USER_INFO_AUTH,"getUserInfoByAuthPage",HttpMethod.GET, GetWeChatUserInfoByAuthPageApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.JS,GetWeChatUserInfoByAuthPageApiRequest.UrlParam.class,null),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * create we-chat official account menu
     */
    CREATE_MENU(WeChatConstants.WeChatApiUrl.POST_MENU_CREATE,"createMenu",HttpMethod.POST, WeChatApiDefaultRes.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null, CreateOfficialMenuApiRequest.CreateMenuBodyParam.class),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * get current self menu for we-chat official account
     */
    GET_CURRENT_SELF_MENU(WeChatConstants.WeChatApiUrl.GET_MENU_LIST,"getCurrentSelfMenu",HttpMethod.GET, GetCurrentSelfMenuInfoApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null,null),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * delete we-chat official self menu
     * <p><em>NOTICE: when you delete we-chat official account self menu by this api,
     * tencent server will delete your official account default menu and all of conditional menu</em></p>
     */
    DELETE_SELF_MENU(WeChatConstants.WeChatApiUrl.GET_MENU_DELETE,"deleteSelfMenu",HttpMethod.GET,WeChatApiDefaultRes.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null,null),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * add conditional official account menu on your we-chat official account application
     */
    ADD_CONDITIONAL_MENU(WeChatConstants.WeChatApiUrl.POST_MENU_ADDCONDITIONAL,"addConditionalMenu",HttpMethod.POST, AddConditionalMenuApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null, CreateOfficialMenuApiRequest.CreateMenuBodyParam.class),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * delete conditional we-chat account menu by menu id
     */
    DELETE_CONDITIONAL_MENU(WeChatConstants.WeChatApiUrl.POST_MENU_DELCONDITIONAL,"deleteConditionalMenu",HttpMethod.POST,WeChatApiDefaultRes.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null, DeleteConditionalMenuApiRequest.BodyParam.class),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * get we-chat menu config
     */
    GET_MENU_CONFIG(WeChatConstants.WeChatApiUrl.GET_MENU_INFO,"getMenuConfig",HttpMethod.GET,GetMenuConfigApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON, null,null),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * try match conditional menu
     */
    TRY_MATCH_CONDITIONAL_MENU(WeChatConstants.WeChatApiUrl.POST_MENU_TRY_MATCH,"tryMatchConditionalMenu",HttpMethod.POST, TryMatchConditionalMenuApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null,TryMatchConditionalMenuApiRequest.BodyParam.class),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * set template message industry
     */
    API_SET_INDUSTRY(WeChatConstants.WeChatApiUrl.POST_TEMPLATE_INDUSTRY_SET,"apiSetIndustry",HttpMethod.POST,WeChatApiDefaultRes.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null, SetIndustryApiRequest.BodyParam.class),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * get template message industry
     */
    GET_API_INDUSTRY(WeChatConstants.WeChatApiUrl.GET_TEMPLATE_INDUSTRY_INFO,"getIndustry",HttpMethod.GET, GetIndustryApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null,null),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * add template for template message
     */
    ADD_TEMPLATE(WeChatConstants.WeChatApiUrl.POST_TEMPLATE_ADD,"apiAddTemplate", HttpMethod.POST, AddTemplateApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null, AddTemplateApiRequest.BodyParam.class),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * get all private template
     */
    GET_ALL_PRIVATE_TEMPLATE(WeChatConstants.WeChatApiUrl.GET_TEMPLATE_PRIVATE_LIST,"getAllPrivateTemplate",HttpMethod.GET, GetAllPrivateTemplateApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null,null),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * delete private template
     */
    DELETE_PRIVATE_TEMPLATE(WeChatConstants.WeChatApiUrl.POST_TEMPLATE_PRIVATE_DEL,"deletePrivateTemplate",HttpMethod.POST,WeChatApiDefaultRes.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null,DeletePrivateTemplateApiRequest.BodyParam.class),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * send template message
     */
    SEND_TEMPLATE_MESSAGE(WeChatConstants.WeChatApiUrl.POST_TEMPLATE_MESSAGE_SEND,"sendTemplateMessage",HttpMethod.POST,SendTemplateApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null,SendTemplateApiRequest.BodyParam.class),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * send subscribe template message
     */
    SEND_SUBSCRIBE_TEMPLATE_MESSAGE(WeChatConstants.WeChatApiUrl.POST_TEMPLATE_MESSAGE_SUBSCRIBE_SEND,"sendSubscribeTemplateMessage",HttpMethod.POST,WeChatApiDefaultRes.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null,SendTemplateApiRequest.BodyParam.class),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * get user from ten cent server
     */
    GET_USER(WeChatConstants.WeChatApiUrl.GET_WECHAT_USER_INFO,"getUser", HttpMethod.GET, GetWeChatUserApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON, GetWeChatUserApiRequest.UrlParam.class,null),

    /**
     * <h3>FIELD DESCRIPTION</h3>
     * get we chat qr code ticket
     */
    GET_QRCODE_TICKET(WeChatConstants.WeChatApiUrl.GET_QRCODE_TICKET,"getQrCodeTicket",HttpMethod.POST, GetQrCodeTicketApiResponse.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null, GetQrCodeTicketApiRequest.BodyParam.class),

    /**
     * <h4>FIELD DESCRIPTION</h4>
     * send custom message
     */
    CUSTOM_MESSAGE_SEND(WeChatConstants.WeChatApiUrl.POST_MESSAGE_CUSTOM_SEND,"sendCustomMessage",HttpMethod.POST,WeChatApiDefaultRes.class,
                    ContentType.APPLICATION_JSON,WeChatApiAccessTokenType.COMMON,null, WeChatCustomerMessage.class),

    ;

    private final String uri;
    private final String name;
    private final HttpMethod httpMethod;
    private final Class<?> responseClass;
    private final ContentType responseContentType;
    private final WeChatApiAccessTokenType accessTokenType;
    private final Class<? extends ApiRequest.RequestUrlParam> urlParamClass;
    private final Class<? extends ApiRequest.RequestBodyParam> bodyParamClass;
}